package week01;

public class T003 {
	static long num = 600851475143L;
	public static void main(String[] args) {
		if(isPrime(num)) {
			System.out.println(num);
			return;
		}else {
			int sq = (int) Math.sqrt(num);
			int max=0;
			for(int i=2;i<=sq;i++) {
				if(num%i==0) {
					if(isPrime(num/i)) {
						max=(int)(num/i);
						break;
					}
					if(isPrime(i)) max=i;
				}
			}
			System.out.println(max);
		}
		
	}
	public static boolean isPrime(long n) {
		if(n<2) return false;
		int sq = (int) Math.sqrt(n);
		for(int i=2;i<=sq;i++) {
			if(n%i==0) return false;
		}
		return true;
	}
}
